package com.kgc.service.impl;

import com.kgc.dao.UserDetailMapper;
import com.kgc.dao.UserDetail_wzlMapper;
import com.kgc.dao.UserMapper;
import com.kgc.dao.UserMapper_wzl;
import com.kgc.pojo.User;
import com.kgc.pojo.UserExample;
import com.kgc.service.UserInfo_wzlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class Userinfo_wzlServiceImpl implements UserInfo_wzlService {

    @Autowired
    private UserMapper userMapper;
    @Autowired
    private UserMapper_wzl userMapper_wzl;
    @Autowired
    private UserDetail_wzlMapper userDetail_wzlMapper;

    /*增加用户*/
    public int  InserUser(String phone,String password,int userdetailid,int isnewuser){
        return userMapper_wzl.inserinfo_wzl(phone,password,userdetailid,isnewuser);
    }
    /*查询最后一个用户*/
    public User selectLastUser(){
        return userMapper_wzl.selectUserLastInfo();
    }
    /*查询用户信息*/
    public User selectUserinfo(String phone){
        return userMapper_wzl.selectUsr_info(phone);
    }

    /*更新用户*/
    public int updateUser( int id , String password){
        return userMapper_wzl.updateByPassword(id,password);
    }
    /*查询用户信息是否相同*/
    public User selectUser(String phone){
        return userMapper_wzl.selectUser(phone);
    }
    /*插入数列时更新userId*/
    public int updateUserid(int id,int userdetailid){
        return userMapper_wzl.updateUserid_wzl(id,userdetailid);
    }
    /*userDetail表插入默认值*/
    public int InserUserDetailinfo_wzl(int id ,String nickname,String picpath){
        return userDetail_wzlMapper.InserUserDetailinfo_wzl(id,nickname,picpath);
    }
}
